          SUBROUTINE (OID,GEN,NO.PT,STATUS,PSTYLE.OVRD,MBX.BODY)
** Version# 16.0002[1] - 03/24/2011 - 03:59pm - SMITJR - eclipse
** Copied from BP SOE.MBX.ORDER Version# 16 - 12/17/2008 - 05:37pm - GREGS - main

*** Subroutine - SOE.MBX.ORDER
*-------------------------------------------------------------------------*
*** Formats all text email Sales Orders
*-------------------------------------------------------------------------*
*** OID         - order ID                                           [IN]
*** GEN         - generation ID                                      [IN]
*** NO.PT       - not used
*** STATUS      - status to send document as                         [IN]
*** PSTYLE.OVRD - print style ovrd sent by user from OE.PRINT.OPTS   [IN]
*** MBX.BODY    - email body                                         [OUT]
*-------------------------------------------------------------------------*

          * Return if Email Orders as Tiff Attachments is active
          EMAIL.CHECK.TIFF 'INV',OID,GEN,,EMAIL.TIFF

          IF EMAIL.TIFF THEN
             MBX.BODY = ''
             RETURN
          END

          EMOID    = OID
          EMGEN    = GEN
          EMSTATUS = STATUS

          * set the print style ID here before we call Bid/Ack/Inv programs
          *** No Override print style
          IF PSTYLE.OVRD = '' THEN
             PSTYLE.GET.ID OID,GEN,PSTYLE.ID,STATUS
             *** If order level print style is BLIND do not send BLIND
             *** Invoices, Bids or Acknowledgements.  If for some reason
             *** the user wants to send a BLIND version of these forms they
             *** can access the Order Reprinting screen and set the print
             *** to BLIND.  This will set BLIND as the Overide print style
             *** and it will be used.
             IF OID[1,1] = "S" AND PSTYLE.ID = "BLIND" THEN
                BEGIN CASE
                *** Invoice
                CASE STATUS = "I"
                   PSTYLE.ID = "NET"
                *** Bid
                CASE STATUS = "B"
                   PSTYLE.ID = "BID"
                *** Acknowledgement
                CASE STATUS # "T" AND STATUS # "O" AND STATUS # "F"
                   PSTYLE.ID = "BID"
                END CASE
             END
          END ELSE
             PSTYLE.ID = PSTYLE.OVRD
          END

          BEGIN CASE
          CASE STATUS = "O"
             SOE.MBX.ACK EMOID,EMGEN,STATUS,PSTYLE.ID,MBX.BODY
          CASE STATUS = 'I'
             SOE.MBX.INVOICE EMOID,EMGEN,PSTYLE.ID,MBX.BODY
          CASE STATUS = 'B'
             SOE.MBX.BID EMOID,EMGEN,PSTYLE.ID,MBX.BODY
          CASE STATUS = "M"
             MBX.BODY = ""
             RETURN
          CASE OTHERWISE
             SOE.MBX.ACK EMOID,EMGEN,STATUS,PSTYLE.ID,MBX.BODY
          END CASE

          RETURN
!SMITJR~03/24/11~15:59
